//
//  TotalViewController.swift
//  Accounting
//
//  Created by Qingke on 16/5/4.
//  Copyright © 2016年 Qingke. All rights reserved.
//

import UIKit

class TotalViewController: UITableViewController {

    @IBOutlet weak var NameIDLabel: UILabel!
    @IBOutlet weak var outputMoneyLabel: UILabel!
    @IBOutlet weak var inputMoneyLabel: UILabel!
    @IBOutlet weak var diffMoneyLabel: UILabel!
    @IBOutlet weak var customIcon: UIImageView!
    
    var nameID: String?
    var ImageName: UIImage?
    var mark:String?
    
    var iconCategory: IconCategory?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
   }
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        
        updateCustom()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    func updateCustom() {
        
        NameIDLabel.text = nameID
        
        let imageData = NSUserDefaults.standardUserDefaults().valueForKey("customIcon") as! NSData
        ImageName = UIImage(data: imageData)
        customIcon.image = ImageName
        //设置圆角
        customIcon.layer.masksToBounds = true
        customIcon.layer.cornerRadius = 38
        
        
        let outputMoney = NSUserDefaults.standardUserDefaults().doubleForKey("outputMoney")
        outputMoneyLabel.text = "\(outputMoney)"
        
        let inputMoney = NSUserDefaults.standardUserDefaults().doubleForKey("inputMoney")
        inputMoneyLabel.text = "\(inputMoney)"
        
        let sum = inputMoney - outputMoney
        diffMoneyLabel.text =  "\(sum)"
        

        
    }
    
    // MARK: - Table view data source
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
//        let navigationController = segue.destinationViewController as! UINavigationController
//        let controller = navigationController.topViewController as! RegistViewController
//        controller.deleage = self
//        

    }


}
//extension TotalViewController: NamePassDelegate {
//    func nameDelegate(NameID: String) {
//        NameIDLabel.text = NameID
//    }
//}